#ifndef SQLOPERATION_H__
#define SQLOPERATION_H__

#include "define.h"
#include "database_def.h"

namespace engine
{
	class DatabaseThread;
	class IQueryCallback;

	//////////////////////////////////////////////////////////////////////////
	class SqlOperation
	{
	public:
		virtual ~SqlOperation() {}

		virtual void execute(DatabaseThread *db) = 0;
	};

	//////////////////////////////////////////////////////////////////////////
	class SqlStatement : public SqlOperation
	{
	private:
		String mSql;

	public:
		SqlStatement(const char* sql) : mSql(sql) {}
		virtual void execute(DatabaseThread* db);
	};

	//////////////////////////////////////////////////////////////////////////
	class SqlQuery : public SqlOperation
	{
	private:
		String mSql;
		IQueryCallback* mCallback;

	public:
		SqlQuery(const char* sql, IQueryCallback* callback) : mSql(sql), mCallback(callback) {}
		virtual void execute(DatabaseThread* db);
	};
}

#endif
